.PHONY: all build build-debug clean run test check query

# 默认目标
all: build

# 构建目标 (优化版本)
build:
	@echo "正在构建发布版本..."
	cargo build --release

# 构建目标 (调试版本)
build-debug:
	@echo "正在构建调试版本..."
	cargo build

# 安装目标
install: build
	@echo "正在安装 filescanner..."
	cp target/release/filescanner /usr/local/bin/

# 运行目标 (默认执行帮助)
run:
	cargo run --release

# 扫描目标 (示例)
scan:
	@echo "扫描当前目录..."
	cargo run --release -- -d .

# 检查目标
check:
	@echo "检查数据库记录..."
	cargo run --release -- -c

# 查询目标
query:
	@echo "查询重复文件..."
	cargo run --release -- -q

# 测试目标
test:
	cargo test

# 清理目标
clean:
	@echo "清理构建文件..."
	cargo clean

# 帮助信息
help:
	@echo "使用方法："
	@echo "  make             - 构建应用程序 (发布版本)"
	@echo "  make build       - 构建应用程序 (发布版本)"
	@echo "  make build-debug - 构建应用程序 (调试版本)"
	@echo "  make install     - 安装应用程序到系统"
	@echo "  make run         - 运行应用程序"
	@echo "  make scan        - 扫描当前目录 (示例)"
	@echo "  make check       - 检查数据库记录"
	@echo "  make query       - 查询重复文件"
	@echo "  make test        - 运行测试"
	@echo "  make clean       - 清理构建文件"
